package cn.tradewin.advisor.pages;

import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.Request;
import org.tynamo.security.SecuritySymbols;
import org.tynamo.security.internal.services.LoginContextService;
import org.tynamo.security.services.SecurityService;

public class deny {
	
	@Inject
	private SecurityService securityService;
	
	@Inject
	private LoginContextService contextService;
	
	@Inject
	private Request request;
	
	Object onLogin() {
		
		contextService.removeSavedRequest();
		
		Subject subject = securityService.getSubject();
		Session session = subject.getSession();
		if (session != null) {
			session.removeAttribute(SecuritySymbols.UNAUTHORIZED_URL);
		}
		subject.logout();
		return login.class;
	}
}
